/** 
 * Project Name:ZhiWeiCateringManagementSystem 
 * File Name:CancelDishRecordAction.java 
 * Package Name:cn.ccit.servers 
 * Date:2016年11月5日下午7:18:38 
 * Copyright (c) 2016, 120026139@qq.com All Rights Reserved. 
 * 
 */

package cn.ccit.action;

import java.util.List;

import com.opensymphony.xwork2.ModelDriven;

import cn.ccit.entites.record.CancelDishRecord;
import cn.ccit.iservers.ICancelDishRecordServers;
import cn.ccit.model.BaseModel;
import cn.ccit.servers.CancelDishRecordServers;

/**
 * ClassName:CancelDishRecordAction <br/>
 * Function: 退菜记录表 <br/>
 * Reason: <br/>
 * Date: 2016年11月5日 下午7:18:38 <br/>
 * 
 * @author Administrator
 * @version
 * @since JDK 1.6
 * @see
 */
public class CancelDishRecordAction extends BaseRecordAction implements
		ModelDriven<CancelDishRecord> {

	/**
	 * serialVersionUID:(版本号).
	 * 
	 * @since JDK 1.6
	 */
	private static final long serialVersionUID = 1L;
	private ICancelDishRecordServers iCancelServers = new CancelDishRecordServers();
	private CancelDishRecord cdr = new CancelDishRecord();

	@Override
	public String addData() {
		sendJsonData(iCancelServers.addCancelDishRecord(cdr),
				new BaseModel<CancelDishRecord>());
		return super.addData();
	}

	@Override
	public String removeData() {
		sendJsonData(iCancelServers.removeCancelDishRecord(cdr),
				new BaseModel<CancelDishRecord>());
		return super.removeData();
	}

	@Override
	public String changeDataInfo() {
		sendJsonData(iCancelServers.changeCancelDishRecordInfo(cdr),
				new BaseModel<CancelDishRecord>());
		return super.changeDataInfo();
	}

	@Override
	public String getDataList() {
		sendJsonDataList(
				iCancelServers.getSomeCancelDishRecords(startId, limit),
				new BaseModel<List<CancelDishRecord>>());
		return super.getDataList();
	}

	@Override
	public String sreachDataById() {
		CancelDishRecord cd=iCancelServers.searchCancelDishRecordByID(cdr.getId());
		sendJsonData(
				cd != null,
				new BaseModel<CancelDishRecord>(),
				cd);
		return super.sreachDataById();
	}

	@Override
	public CancelDishRecord getModel() {
		return cdr;
	}

	@Override
	public String searchDataListByYear() {
		sendJsonDataList(
				iCancelServers.searchCancelDishRecordByYear(cdr.getOrderYear()),
				new BaseModel<List<CancelDishRecord>>());
		return super.searchDataListByYear();
	}

	@Override
	public String searchDataListByMonth() {
		sendJsonDataList(iCancelServers.searchCancelDishRecordByMonth(cdr
				.getOrderMonth()), new BaseModel<List<CancelDishRecord>>());
		return super.searchDataListByMonth();
	}

	@Override
	public String searchDataListByDate() {
		sendJsonDataList(
				iCancelServers.searchCancelDishRecordByDate(cdr.getOrderDate()),
				new BaseModel<List<CancelDishRecord>>());
		return super.searchDataListByDate();
	}

}
